package edu.lingnan.lingnanblog.service;

import edu.lingnan.lingnanblog.entity.Blog;
import edu.lingnan.lingnanblog.entity.BlogType;
import net.sf.json.util.JSONUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author wuyuan
 * @since 2020-06-15 22:24
 */
@Component
@FeignClient(value = "LINGNANBLOG-PROVIDER-BLOG")
public interface BlogClientService {

    @RequestMapping("blog/list")
    List<Blog> list(@SpringQueryMap Map<String, Object> map);

    @RequestMapping("blog/getTotal")
    Long getTotal(@SpringQueryMap Map<String, Object> map);

    @RequestMapping("blog/add")
    Integer add(@SpringQueryMap Blog blog, @SpringQueryMap BlogType blogType);

    @RequestMapping("blog/update")
    Integer update(@SpringQueryMap Blog blog, @SpringQueryMap BlogType blogType);

    @RequestMapping("blog/delete")
    Integer delete(@RequestParam("ids") int ids);

    @RequestMapping("blog/getById")
    Blog getById(@RequestParam("id") Integer id);

    @RequestMapping("blog/toWriteBlog")
    List<BlogType> toWriteBlog();

    @RequestMapping("blog/toModifyBlog")
    List<BlogType> toModifyBlog();


    @RequestMapping("/blogType/list")
    List<BlogType> listType(@SpringQueryMap Map<String, Object> map);
    @RequestMapping("/blogType/getTotal")
    Long getTypeTotal(@SpringQueryMap Map<String, Object> map);

    @RequestMapping("/blogType/add")
    Integer addType(@SpringQueryMap BlogType blogType);

    @RequestMapping("/blogType/update")
    Integer updateType(@SpringQueryMap BlogType blogType);

    @RequestMapping("/blogType/getBlogByTypeId")
    Integer getBlogByTypeId(@RequestParam(value="id") int id);

    @RequestMapping("/blogType/delete")
    Integer deleteType(@RequestParam(value="id") int id);

}
